Ví dụ LaTeX

Ví dụ dưới đây cho thấy đầu vào LaTeX và đầu ra tương ứng:

Đầu vàoĐầu ra
\documentclass{article} % Bắt đầu một bài báo\usepackage{amsmath} % Khai báo gói lệnh làm việc trong môi trường toán học\title{\LaTeX} % Tiêu đề\begin{document} % Bắt đầu một tài liệu \maketitle \LaTeX{} is a document preparation system for the \TeX{} typesetting program. It offers programmable desktop publishing features and extensive facilities for automating most aspects of typesetting and desktop publishing, including numbering and cross-referencing, tables and figures, page layout, bibliographies, and much more. \LaTeX{} was originally written in 1984 by Leslie Lamport and has become the dominant method for using \TeX; few people write in plain \TeX{} anymore. The current version is \LaTeXe. % Đây là nhận xét, không hiển thị trong đầu ra % Phần dưới cho thấy khả năng sắp xếp các biểu thức của LaTeX: \begin{align}  E_0 &= mc^2 \\  E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}} \end{align} \end{document}

Lưu ý phương trình cho E {\displaystyle E} (được đánh dấu trong mã ví dụ) đã được sắp thẳng hàng dấu bằng bởi đánh dấu:

E &= \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}}

trong đó căn bậc hai được biểu thị bằng "\sqrt{đối số}" và các phân số là "\frac{tử số}{mẫu số}".